home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 January: Technology Seed / Jan. '98 ATS.toast / QuickTime™ 3.0b11 / QTPublicInterfaces / CIncludes / QD3D.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-01-12  |  41.8 KB  |  1,197 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        QD3D.h
  3.  
  4.      Contains:    Base types for Quickdraw 3D                            
  5.  
  6.      Version:    Technology:    Quickdraw 3D 1.5.1
  7.                  Release:    QuickTime 3.0 Beta
  8.  
  9.      Copyright:    © 1995-1997 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __QD3D__
  19. #define __QD3D__
  20.  
  21. #ifndef __CONDITIONALMACROS__
  22. #include <ConditionalMacros.h>
  23. #endif
  24.  
  25. #if TARGET_OS_MAC
  26. #ifndef __MACTYPES__
  27. #include <MacTypes.h>
  28. #endif
  29. #endif  /* TARGET_OS_MAC */
  30.  
  31. #include <stdio.h>
  32.  
  33.  
  34. #if PRAGMA_ONCE
  35. #pragma once
  36. #endif
  37.  
  38. #ifdef __cplusplus
  39. extern "C" {
  40. #endif
  41.  
  42. #if PRAGMA_IMPORT
  43. #pragma import on
  44. #endif
  45.  
  46. #if PRAGMA_STRUCT_ALIGN
  47.     #pragma options align=power
  48. #elif PRAGMA_STRUCT_PACKPUSH
  49.     #pragma pack(push, 2)
  50. #elif PRAGMA_STRUCT_PACK
  51.     #pragma pack(2)
  52. #endif
  53.  
  54. #if PRAGMA_ENUM_ALWAYSINT
  55.     #pragma enumsalwaysint on
  56. #elif PRAGMA_ENUM_OPTIONS
  57.     #pragma option enum=int
  58. #elif PRAGMA_ENUM_PACK
  59.     #if __option(pack_enums)
  60.         #define PRAGMA_ENUM_PACK__QD3D__
  61.     #endif
  62.     #pragma options(!pack_enums)
  63. #endif
  64.  
  65. #if TARGET_OS_MAC
  66. #define OS_MACINTOSH 1
  67. #define OS_WIN32 0
  68. #define OS_UNIX 0
  69. #define OS_NEXT 0
  70. #define WINDOW_SYSTEM_MACINTOSH 1
  71. #define WINDOW_SYSTEM_WIN32 0
  72. #define WINDOW_SYSTEM_X11 0
  73. #define WINDOW_SYSTEM_NEXT 0
  74. #endif  /* TARGET_OS_MAC */
  75.  
  76. #if TARGET_OS_WIN32
  77. #define OS_MACINTOSH 0
  78. #define OS_WIN32 1
  79. #define OS_UNIX 0
  80. #define OS_NEXT 0
  81. #define WINDOW_SYSTEM_MACINTOSH 0
  82. #define WINDOW_SYSTEM_WIN32 1
  83. #define WINDOW_SYSTEM_X11 0
  84. #define WINDOW_SYSTEM_NEXT 0
  85. #endif  /* TARGET_OS_WIN32 */
  86.  
  87.  
  88. /******************************************************************************
  89.  **                                                                             **
  90.  **                                Export Control                                 **
  91.  **                                                                             **
  92.  *****************************************************************************/
  93. #if TARGET_OS_WIN32
  94.     #if defined(WIN32_EXPORTING)    /* define when building DLL */
  95.         #define QD3D_EXPORT __declspec( dllexport )     
  96.         #define QD3D_CALL    
  97.         #define QD3D_CALLBACK    
  98.     #else
  99.         #define QD3D_EXPORT __declspec( dllimport )    
  100.         #define QD3D_CALL    __cdecl
  101.         #define QD3D_CALLBACK    __cdecl    
  102.     #endif /* WIN32_EXPORTING */
  103. #else
  104.     #define QD3D_EXPORT
  105.     #define QD3D_CALL    
  106.     #define QD3D_CALLBACK    
  107. #endif  /*  TARGET_OS_WIN32  */
  108.  
  109.  
  110. /******************************************************************************
  111.  **                                                                             **
  112.  **                                NULL definition                                 **
  113.  **                                                                             **
  114.  *****************************************************************************/
  115.  
  116. #ifndef NULL
  117.     #error /*    NULL is undefined?    */
  118. #endif /* NULL */
  119.  
  120. /******************************************************************************
  121.  **                                                                             **
  122.  **                                    Objects                                     **
  123.  **                                                                             **
  124.  *****************************************************************************/
  125. /*
  126.  * Everything in QuickDraw 3D is an OBJECT: a bunch of data with a type,
  127.  * deletion, duplication, and i/o methods.
  128.  */
  129. #if TARGET_OS_MAC
  130. typedef FourCharCode                     TQ3ObjectType;
  131. #else
  132. typedef long                             TQ3ObjectType;
  133. #endif  /* TARGET_OS_MAC */
  134.  
  135. typedef struct OpaqueTQ3Object*         TQ3Object;
  136. /*
  137.  * There are four subclasses of OBJECT:
  138.  *    an ELEMENT, which is data that is placed in a SET
  139.  *    a SHAREDOBJECT, which is reference-counted data that is shared
  140.  *    VIEWs, which maintain state information for an image
  141.  *    a PICK, which used to query a VIEW
  142.  */
  143. typedef TQ3Object                         TQ3ElementObject;
  144. typedef TQ3Object                         TQ3SharedObject;
  145. typedef TQ3Object                         TQ3ViewObject;
  146. typedef TQ3Object                         TQ3PickObject;
  147. /*
  148.  * There are several types of SharedObjects:
  149.  *    RENDERERs, which paint to a drawContext
  150.  *    DRAWCONTEXTs, which are an interface to a device 
  151.  *    SETs, which maintains "mathematical sets" of ELEMENTs
  152.  *    FILEs, which maintain state information for a metafile
  153.  *    SHAPEs, which affect the state of the View
  154.  *    SHAPEPARTs, which contain geometry-specific data about a picking hit
  155.  *    CONTROLLERSTATEs, which hold state of the output channels for a CONTROLLER
  156.  *    TRACKERs, which represent a position and orientation in the user interface
  157.  *  STRINGs, which are abstractions of text string data.
  158.  *    STORAGE, which is an abstraction for stream-based data storage (files, memory)
  159.  *    TEXTUREs, for sharing bitmap information for TEXTURESHADERS
  160.  *    VIEWHINTs, which specifies viewing preferences in FILEs
  161.  */
  162. typedef TQ3SharedObject                 TQ3RendererObject;
  163. typedef TQ3SharedObject                 TQ3DrawContextObject;
  164. typedef TQ3SharedObject                 TQ3SetObject;
  165. typedef TQ3SharedObject                 TQ3FileObject;
  166. typedef TQ3SharedObject                 TQ3ShapeObject;
  167. typedef TQ3SharedObject                 TQ3ShapePartObject;
  168. typedef TQ3SharedObject                 TQ3ControllerStateObject;
  169. typedef TQ3SharedObject                 TQ3TrackerObject;
  170. typedef TQ3SharedObject                 TQ3StringObject;
  171. typedef TQ3SharedObject                 TQ3StorageObject;
  172. typedef TQ3SharedObject                 TQ3TextureObject;
  173. typedef TQ3SharedObject                 TQ3ViewHintsObject;
  174. /*
  175.  * There is one types of SET:
  176.  *    ATTRIBUTESETs, which contain ATTRIBUTEs which are inherited 
  177.  */
  178. typedef TQ3SetObject                     TQ3AttributeSet;
  179. /*
  180.  * There are many types of SHAPEs:
  181.  *    LIGHTs, which affect how the RENDERER draws 3-D cues
  182.  *    CAMERAs, which affects the location and orientation of the RENDERER in space
  183.  *    GROUPs, which may contain any number of SHARED OBJECTS
  184.  *    GEOMETRYs, which are representations of three-dimensional data
  185.  *    SHADERs, which affect how colors are drawn on a geometry
  186.  *    STYLEs, which affect how the RENDERER paints to the DRAWCONTEXT
  187.  *    TRANSFORMs, which affect the coordinate system in the VIEW
  188.  *    REFERENCEs, which are references to objects in FILEs
  189.  *  UNKNOWN, which hold unknown objects read from a metafile.
  190.  */
  191. typedef TQ3ShapeObject                     TQ3GroupObject;
  192. typedef TQ3ShapeObject                     TQ3GeometryObject;
  193. typedef TQ3ShapeObject                     TQ3ShaderObject;
  194. typedef TQ3ShapeObject                     TQ3StyleObject;
  195. typedef TQ3ShapeObject                     TQ3TransformObject;
  196. typedef TQ3ShapeObject                     TQ3LightObject;
  197. typedef TQ3ShapeObject                     TQ3CameraObject;
  198. typedef TQ3ShapeObject                     TQ3UnknownObject;
  199. typedef TQ3ShapeObject                     TQ3ReferenceObject;
  200. /*
  201.  * For now, there is only one type of SHAPEPARTs:
  202.  *    MESHPARTs, which describe some part of a mesh
  203.  */
  204. typedef TQ3ShapePartObject                 TQ3MeshPartObject;
  205. /*
  206.  * There are three types of MESHPARTs:
  207.  *    MESHFACEPARTs, which describe a face of a mesh
  208.  *    MESHEDGEPARTs, which describe a edge of a mesh
  209.  *    MESHVERTEXPARTs, which describe a vertex of a mesh
  210.  */
  211. typedef TQ3MeshPartObject                 TQ3MeshFacePartObject;
  212. typedef TQ3MeshPartObject                 TQ3MeshEdgePartObject;
  213. typedef TQ3MeshPartObject                 TQ3MeshVertexPartObject;
  214. /*
  215.  * A DISPLAY Group can be drawn to a view
  216.  */
  217. typedef TQ3GroupObject                     TQ3DisplayGroupObject;
  218. /*
  219.  * There are many types of SHADERs:
  220.  *    SURFACESHADERs, which affect how the surface of a geometry is painted
  221.  *    ILLUMINATIONSHADERs, which affect how lights affect the color of a surface
  222.  */
  223. typedef TQ3ShaderObject                 TQ3SurfaceShaderObject;
  224. typedef TQ3ShaderObject                 TQ3IlluminationShaderObject;
  225. /*
  226.  * A handle to an object in a group
  227.  */
  228. typedef struct OpaqueTQ3GroupPosition*     TQ3GroupPosition;
  229. /* 
  230.  * TQ3ObjectClassNameString is used for the class name of an object
  231.  */
  232.  
  233. enum {
  234.     kQ3StringMaximumLength        = 1024
  235. };
  236.  
  237. typedef char                             TQ3ObjectClassNameString[1024];
  238. /******************************************************************************
  239.  **                                                                             **
  240.  **                            Client/Server Things                             **
  241.  **                                                                             **
  242.  *****************************************************************************/
  243. typedef void *                            TQ3ControllerRef;
  244. /******************************************************************************
  245.  **                                                                             **
  246.  **                            Flags and Switches                                 **
  247.  **                                                                             **
  248.  *****************************************************************************/
  249.  
  250. enum {
  251.     kQ3False                    = 0,
  252.     kQ3True                        = 1
  253. };
  254.  
  255. typedef unsigned long                     TQ3Boolean;
  256.  
  257. enum {
  258.     kQ3Off                        = 0,
  259.     kQ3On                        = 1
  260. };
  261.  
  262. typedef unsigned long                     TQ3Switch;
  263.  
  264. enum {
  265.     kQ3Failure                    = 0,
  266.     kQ3Success                    = 1
  267. };
  268.  
  269. typedef unsigned long                     TQ3Status;
  270.  
  271. enum {
  272.     kQ3AxisX                    = 0,
  273.     kQ3AxisY                    = 1,
  274.     kQ3AxisZ                    = 2
  275. };
  276.  
  277. typedef unsigned long                     TQ3Axis;
  278.  
  279. enum {
  280.     kQ3PixelTypeRGB32            = 0,                            /* Alpha:8 (ignored), R:8, G:8, B:8    */
  281.     kQ3PixelTypeARGB32            = 1,                            /* Alpha:8, R:8, G:8, B:8             */
  282.     kQ3PixelTypeRGB16            = 2,                            /* Alpha:1 (ignored), R:5, G:5, B:5    */
  283.     kQ3PixelTypeARGB16            = 3,                            /* Alpha:1, R:5, G:5, B:5             */
  284.     kQ3PixelTypeRGB16_565        = 4,                            /* Win32 only: 16 bits/pixel, R:5, G:6, B:5        */
  285.     kQ3PixelTypeRGB24            = 5                                /* Win32 only: 24 bits/pixel, R:8, G:8, B:8        */
  286. };
  287.  
  288. typedef unsigned long                     TQ3PixelType;
  289.  
  290. enum {
  291.     kQ3EndianBig                = 0,
  292.     kQ3EndianLittle                = 1
  293. };
  294.  
  295. typedef unsigned long                     TQ3Endian;
  296.  
  297. enum {
  298.     kQ3EndCapNone                = 0,
  299.     kQ3EndCapMaskTop            = 1 << 0,
  300.     kQ3EndCapMaskBottom            = 1 << 1,
  301.     kQ3EndCapMaskInterior        = 1 << 2
  302. };
  303.  
  304. typedef unsigned long                     TQ3EndCap;
  305. enum {    kQ3ArrayIndexNULL = ~0    };
  306. /******************************************************************************
  307.  **                                                                             **
  308.  **                        Point and Vector Definitions                         **
  309.  **                                                                             **
  310.  *****************************************************************************/
  311.  
  312. struct TQ3Vector2D {
  313.     float                             x;
  314.     float                             y;
  315. };
  316. typedef struct TQ3Vector2D                TQ3Vector2D;
  317.  
  318. struct TQ3Vector3D {
  319.     float                             x;
  320.     float                             y;
  321.     float                             z;
  322. };
  323. typedef struct TQ3Vector3D                TQ3Vector3D;
  324.  
  325. struct TQ3Point2D {
  326.     float                             x;
  327.     float                             y;
  328. };
  329. typedef struct TQ3Point2D                TQ3Point2D;
  330.  
  331. struct TQ3Point3D {
  332.     float                             x;
  333.     float                             y;
  334.     float                             z;
  335. };
  336. typedef struct TQ3Point3D                TQ3Point3D;
  337.  
  338. struct TQ3RationalPoint4D {
  339.     float                             x;
  340.     float                             y;
  341.     float                             z;
  342.     float                             w;
  343. };
  344. typedef struct TQ3RationalPoint4D        TQ3RationalPoint4D;
  345.  
  346. struct TQ3RationalPoint3D {
  347.     float                             x;
  348.     float                             y;
  349.     float                             w;
  350. };
  351. typedef struct TQ3RationalPoint3D        TQ3RationalPoint3D;
  352. /******************************************************************************
  353.  **                                                                             **
  354.  **                                Quaternion                                     **
  355.  **                                                                             **
  356.  *****************************************************************************/
  357.  
  358. struct TQ3Quaternion {
  359.     float                             w;
  360.     float                             x;
  361.     float                             y;
  362.     float                             z;
  363. };
  364. typedef struct TQ3Quaternion            TQ3Quaternion;
  365. /******************************************************************************
  366.  **                                                                             **
  367.  **                                Ray Definition                                 **
  368.  **                                                                             **
  369.  *****************************************************************************/
  370.  
  371. struct TQ3Ray3D {
  372.     TQ3Point3D                         origin;
  373.     TQ3Vector3D                     direction;
  374. };
  375. typedef struct TQ3Ray3D                    TQ3Ray3D;
  376. /******************************************************************************
  377.  **                                                                             **
  378.  **                        Parameterization Data Structures                     **
  379.  **                                                                             **
  380.  *****************************************************************************/
  381.  
  382. struct TQ3Param2D {
  383.     float                             u;
  384.     float                             v;
  385. };
  386. typedef struct TQ3Param2D                TQ3Param2D;
  387.  
  388. struct TQ3Param3D {
  389.     float                             u;
  390.     float                             v;
  391.     float                             w;
  392. };
  393. typedef struct TQ3Param3D                TQ3Param3D;
  394.  
  395. struct TQ3Tangent2D {
  396.     TQ3Vector3D                     uTangent;
  397.     TQ3Vector3D                     vTangent;
  398. };
  399. typedef struct TQ3Tangent2D                TQ3Tangent2D;
  400.  
  401. struct TQ3Tangent3D {
  402.     TQ3Vector3D                     uTangent;
  403.     TQ3Vector3D                     vTangent;
  404.     TQ3Vector3D                     wTangent;
  405. };
  406. typedef struct TQ3Tangent3D                TQ3Tangent3D;
  407. /******************************************************************************
  408.  **                                                                             **
  409.  **                        Polar and Spherical Coordinates                         **
  410.  **                                                                             **
  411.  *****************************************************************************/
  412.  
  413. struct TQ3PolarPoint {
  414.     float                             r;
  415.     float                             theta;
  416. };
  417. typedef struct TQ3PolarPoint            TQ3PolarPoint;
  418.  
  419. struct TQ3SphericalPoint {
  420.     float                             rho;
  421.     float                             theta;
  422.     float                             phi;
  423. };
  424. typedef struct TQ3SphericalPoint        TQ3SphericalPoint;
  425. /******************************************************************************
  426.  **                                                                             **
  427.  **                            Color Definition                                 **
  428.  **                                                                             **
  429.  *****************************************************************************/
  430.  
  431. struct TQ3ColorRGB {
  432.     float                             r;
  433.     float                             g;
  434.     float                             b;
  435. };
  436. typedef struct TQ3ColorRGB                TQ3ColorRGB;
  437.  
  438. struct TQ3ColorARGB {
  439.     float                             a;
  440.     float                             r;
  441.     float                             g;
  442.     float                             b;
  443. };
  444. typedef struct TQ3ColorARGB                TQ3ColorARGB;
  445. /******************************************************************************
  446.  **                                                                             **
  447.  **                                    Vertices                                 **
  448.  **                                                                             **
  449.  *****************************************************************************/
  450.  
  451. struct TQ3Vertex3D {
  452.     TQ3Point3D                         point;
  453.     TQ3AttributeSet                 attributeSet;
  454. };
  455. typedef struct TQ3Vertex3D                TQ3Vertex3D;
  456. /******************************************************************************
  457.  **                                                                             **
  458.  **                                    Matrices                                 **
  459.  **                                                                             **
  460.  *****************************************************************************/
  461.  
  462. struct TQ3Matrix3x3 {
  463.     float                             value[3][3];
  464. };
  465. typedef struct TQ3Matrix3x3                TQ3Matrix3x3;
  466.  
  467. struct TQ3Matrix4x4 {
  468.     float                             value[4][4];
  469. };
  470. typedef struct TQ3Matrix4x4                TQ3Matrix4x4;
  471. /******************************************************************************
  472.  **                                                                             **
  473.  **                                Bitmap/Pixmap                                 **
  474.  **                                                                             **
  475.  *****************************************************************************/
  476.  
  477. struct TQ3Pixmap {
  478.     void *                            image;
  479.     unsigned long                     width;
  480.     unsigned long                     height;
  481.     unsigned long                     rowBytes;
  482.     unsigned long                     pixelSize;                    /* MUST be 16 or 32 to use with the    Interactive Renderer on Mac OS*/
  483.     TQ3PixelType                     pixelType;
  484.     TQ3Endian                         bitOrder;
  485.     TQ3Endian                         byteOrder;
  486. };
  487. typedef struct TQ3Pixmap                TQ3Pixmap;
  488.  
  489. struct TQ3StoragePixmap {
  490.     TQ3StorageObject                 image;
  491.     unsigned long                     width;
  492.     unsigned long                     height;
  493.     unsigned long                     rowBytes;
  494.     unsigned long                     pixelSize;                    /* MUST be 16 or 32 to use with the    Interactive Renderer on Mac OS*/
  495.     TQ3PixelType                     pixelType;
  496.     TQ3Endian                         bitOrder;
  497.     TQ3Endian                         byteOrder;
  498. };
  499. typedef struct TQ3StoragePixmap            TQ3StoragePixmap;
  500.  
  501. struct TQ3Bitmap {
  502.     unsigned char *                    image;
  503.     unsigned long                     width;
  504.     unsigned long                     height;
  505.     unsigned long                     rowBytes;
  506.     TQ3Endian                         bitOrder;
  507. };
  508. typedef struct TQ3Bitmap                TQ3Bitmap;
  509.  
  510. struct TQ3MipmapImage {                                            /* An image for use as a texture mipmap  */
  511.     unsigned long                     width;                        /* Width of mipmap, must be power of 2   */
  512.     unsigned long                     height;                        /* Height of mipmap, must be power of 2  */
  513.     unsigned long                     rowBytes;                    /* Rowbytes of mipmap                    */
  514.     unsigned long                     offset;                        /* Offset from image base to this mipmap */
  515. };
  516. typedef struct TQ3MipmapImage            TQ3MipmapImage;
  517.  
  518. struct TQ3Mipmap {
  519.     TQ3StorageObject                 image;                        /* Data containing the texture map and     */
  520.                                                                 /* if (useMipmapping==kQ3True) the         */
  521.                                                                 /* mipmap data                             */
  522.     TQ3Boolean                         useMipmapping;                /* True if mipmapping should be used     */
  523.                                                                 /* and all mipmaps have been provided   */
  524.     TQ3PixelType                     pixelType;
  525.     TQ3Endian                         bitOrder;
  526.     TQ3Endian                         byteOrder;
  527.     unsigned long                     reserved;                    /* leave NULL for next version */
  528.     TQ3MipmapImage                     mipmaps[32];                /* The actual number of mipmaps is         */
  529.                                                                 /* determined from the size of the         */
  530.                                                                 /* first mipmap                            */
  531. };
  532. typedef struct TQ3Mipmap                TQ3Mipmap;
  533. EXTERN_API_C( TQ3Status )
  534. Q3Bitmap_Empty                    (TQ3Bitmap *            bitmap);
  535.  
  536. EXTERN_API_C( unsigned long )
  537. Q3Bitmap_GetImageSize            (unsigned long             width,
  538.                                  unsigned long             height);
  539.  
  540.  
  541. /******************************************************************************
  542.  **                                                                             **
  543.  **                        Higher dimension quantities                             **
  544.  **                                                                             **
  545.  *****************************************************************************/
  546.  
  547. struct TQ3Area {
  548.     TQ3Point2D                         min;
  549.     TQ3Point2D                         max;
  550. };
  551. typedef struct TQ3Area                    TQ3Area;
  552.  
  553. struct TQ3PlaneEquation {
  554.     TQ3Vector3D                     normal;
  555.     float                             constant;
  556. };
  557. typedef struct TQ3PlaneEquation            TQ3PlaneEquation;
  558.  
  559. struct TQ3BoundingBox {
  560.     TQ3Point3D                         min;
  561.     TQ3Point3D                         max;
  562.     TQ3Boolean                         isEmpty;
  563. };
  564. typedef struct TQ3BoundingBox            TQ3BoundingBox;
  565.  
  566. struct TQ3BoundingSphere {
  567.     TQ3Point3D                         origin;
  568.     float                             radius;
  569.     TQ3Boolean                         isEmpty;
  570. };
  571. typedef struct TQ3BoundingSphere        TQ3BoundingSphere;
  572. /*
  573.  *    The TQ3ComputeBounds flag passed to StartBoundingBox or StartBoundingSphere
  574.  *    calls in the View. It's a hint to the system as to how it should 
  575.  *    compute the bbox of a shape:
  576.  *
  577.  *    kQ3ComputeBoundsExact:    
  578.  *        Vertices of shapes are transformed into world space and
  579.  *        the world space bounding box is computed from them.  Slow!
  580.  *    
  581.  *    kQ3ComputeBoundsApproximate: 
  582.  *        A local space bounding box is computed from a shape's
  583.  *        vertices.  This bbox is then transformed into world space,
  584.  *        and its bounding box is taken as the shape's approximate
  585.  *        bbox.  Fast but the bbox is larger than optimal.
  586.  */
  587.  
  588. enum {
  589.     kQ3ComputeBoundsExact        = 0,
  590.     kQ3ComputeBoundsApproximate    = 1
  591. };
  592.  
  593.  
  594. typedef unsigned long                     TQ3ComputeBounds;
  595. /******************************************************************************
  596.  **                                                                             **
  597.  **                            Object System Types                                 **
  598.  **                                                                             **
  599.  *****************************************************************************/
  600. typedef struct OpaqueTQ3ObjectClass*     TQ3ObjectClass;
  601. typedef unsigned long                     TQ3MethodType;
  602. /*
  603.  * Object methods
  604.  */
  605. #define kQ3MethodTypeObjectUnregister        Q3_METHOD_TYPE('u','n','r','g')
  606. /*
  607.  * IO Methods
  608.  */
  609. #define kQ3MethodTypeObjectFileVersion        Q3_METHOD_TYPE('v','e','r','s') /* version */
  610. #define kQ3MethodTypeObjectTraverse            Q3_METHOD_TYPE('t','r','v','s') /* byte count */
  611. #define kQ3MethodTypeObjectTraverseData        Q3_METHOD_TYPE('t','r','v','d') /* byte count */
  612. #define kQ3MethodTypeObjectWrite            Q3_METHOD_TYPE('w','r','i','t') /* Dump info to file */
  613. #define kQ3MethodTypeObjectReadData            Q3_METHOD_TYPE('r','d','d','t') /* Read info from file into buffer or, attach read data to parent */ 
  614. typedef CALLBACK_API_C( void , TQ3FunctionPointer )(void );
  615. typedef CALLBACK_API_C( TQ3FunctionPointer , TQ3MetaHandler )(TQ3MethodType methodType);
  616. /*
  617.  * MetaHandler:
  618.  *        When you give a metahandler to QuickDraw 3D, it is called multiple times to
  619.  *        build method tables, and then is thrown away. You are guaranteed that
  620.  *        your metahandler will never be called again after a call that was passed
  621.  *        a metahandler returns.
  622.  *
  623.  *        Your metahandler should contain a switch on the methodType passed to it
  624.  *        and should return the corresponding method as an TQ3FunctionPointer.
  625.  *
  626.  *        IMPORTANT: A metaHandler MUST always "return" a value. If you are
  627.  *        passed a methodType that you do not understand, ALWAYS return NULL.
  628.  *
  629.  *        These types here are prototypes of how your functions should look.
  630.  */
  631. typedef CALLBACK_API_C( TQ3Status , TQ3ObjectUnregisterMethod )(TQ3ObjectClass objectClass);
  632. typedef struct OpaqueTQ3XObjectClass*     TQ3XObjectClass;
  633. typedef unsigned long                     TQ3XMethodType;
  634. /*
  635.  * Object methods
  636.  */
  637. #define kQ3XMethodTypeObjectUnregister        Q3_METHOD_TYPE('u','n','r','g')
  638. #define kQ3XMethodTypeObjectIsDrawable        Q3_METHOD_TYPE('i','s','d','r')    /* return true from the metahandler if this object can be submitted in a rendering loop */
  639. typedef CALLBACK_API_C( void , TQ3XFunctionPointer )(void );
  640. typedef CALLBACK_API_C( TQ3XFunctionPointer , TQ3XMetaHandler )(TQ3XMethodType methodType);
  641. /*
  642.  * MetaHandler:
  643.  *        When you give a metahandler to QuickDraw 3D, it is called multiple 
  644.  *        times to build method tables, and then is thrown away. You are 
  645.  *        guaranteed that your metahandler will never be called again after a 
  646.  *        call that was passed a metahandler returns.
  647.  *
  648.  *        Your metahandler should contain a switch on the methodType passed to it
  649.  *        and should return the corresponding method as an TQ3XFunctionPointer.
  650.  *
  651.  *        IMPORTANT: A metaHandler MUST always "return" a value. If you are
  652.  *        passed a methodType that you do not understand, ALWAYS return NULL.
  653.  *
  654.  *        These types here are prototypes of how your functions should look.
  655.  */
  656. typedef CALLBACK_API_C( TQ3Status , TQ3XObjectUnregisterMethod )(TQ3XObjectClass objectClass);
  657. /*
  658.  * See QD3DIO.h for the IO method types: 
  659.  *        ObjectReadData, ObjectTraverse, ObjectWrite
  660.  */
  661.  
  662. /******************************************************************************
  663.  **                                                                             **
  664.  **                                Set Types                                     **
  665.  **                                                                             **
  666.  *****************************************************************************/
  667. typedef long                             TQ3ElementType;
  668.  
  669. #define kQ3ElementTypeNone        0
  670. #define kQ3ElementTypeUnknown    32
  671. #define kQ3ElementTypeSet        33
  672.  
  673. /* 
  674.  *    kQ3ElementTypeUnknown is a TQ3Object. 
  675.  *    
  676.  *        Do Q3Set_Add(s, ..., &obj) or Q3Set_Get(s, ..., &obj);
  677.  *        
  678.  *        Note that the object is always referenced when copying around. 
  679.  *        
  680.  *        Generally, it is an Unknown object, a Group of Unknown objects, or a 
  681.  *        group of other "objects" which have been found in the metafile and
  682.  *        have no attachment method to their parent. Be prepared to handle
  683.  *        any or all of these cases if you actually access the set on a shape.
  684.  *
  685.  *    kQ3ElementTypeSet is a TQ3SetObject. 
  686.  *    
  687.  *        Q3Shape_GetSet(s,&o) is eqivalent to 
  688.  *            Q3Shape_GetElement(s, kQ3ElementTypeSet, &o)
  689.  *            
  690.  *        Q3Shape_SetSet(s,o)  is eqivalent to 
  691.  *            Q3Shape_SetElement(s, kQ3ElementTypeSet, &o)
  692.  *    
  693.  *        Note that the object is always referenced when copying around. 
  694.  *        
  695.  *    See the note below about the Set and Shape changes.
  696.  */
  697.  
  698. /******************************************************************************
  699.  **                                                                             **
  700.  **                            Object System Macros                             **
  701.  **                                                                             **
  702.  *****************************************************************************/
  703.  
  704. #define Q3_FOUR_CHARACTER_CONSTANT(a,b,c,d)         \
  705.             ((const unsigned long)                     \
  706.             ((const unsigned long) (a) << 24) |     \
  707.             ((const unsigned long) (b) << 16) |        \
  708.             ((const unsigned long) (c) << 8)  |     \
  709.             ((const unsigned long) (d)))
  710.  
  711. #define Q3_OBJECT_TYPE(a,b,c,d) \
  712.     ((TQ3ObjectType) Q3_FOUR_CHARACTER_CONSTANT(a,b,c,d))
  713.  
  714. #define Q3_METHOD_TYPE(a,b,c,d) \
  715.     ((TQ3MethodType) Q3_FOUR_CHARACTER_CONSTANT(a,b,c,d))
  716.  
  717. /******************************************************************************
  718.  **                                                                             **
  719.  **                                Object Types                                 **
  720.  **                                                                             **
  721.  *****************************************************************************/
  722. /*
  723.  * Note:    a call to Q3Foo_GetType will return a value kQ3FooTypeBar
  724.  *            e.g. Q3Shared_GetType(object) returns kQ3SharedTypeShape, etc.
  725.  */
  726.  
  727. #define kQ3ObjectTypeInvalid                            0
  728. #define kQ3ObjectTypeView                                ((TQ3ObjectType)FOUR_CHAR_CODE('view'))
  729. #define kQ3ObjectTypeElement                            ((TQ3ObjectType)FOUR_CHAR_CODE('elmn'))
  730.     #define kQ3ElementTypeAttribute                        ((TQ3ObjectType)FOUR_CHAR_CODE('eatt'))
  731. #define kQ3ObjectTypePick                                ((TQ3ObjectType)FOUR_CHAR_CODE('pick'))
  732.     #define kQ3PickTypeWindowPoint                        ((TQ3ObjectType)FOUR_CHAR_CODE('pkwp'))
  733.     #define kQ3PickTypeWindowRect                        ((TQ3ObjectType)FOUR_CHAR_CODE('pkwr'))
  734. #define kQ3ObjectTypeShared                                ((TQ3ObjectType)FOUR_CHAR_CODE('shrd'))
  735.     #define kQ3SharedTypeRenderer                        ((TQ3ObjectType)FOUR_CHAR_CODE('rddr'))
  736.         #define kQ3RendererTypeWireFrame                ((TQ3ObjectType)FOUR_CHAR_CODE('wrfr'))
  737.         #define kQ3RendererTypeGeneric                    ((TQ3ObjectType)FOUR_CHAR_CODE('gnrr'))
  738.         #define kQ3RendererTypeInteractive                ((TQ3ObjectType)FOUR_CHAR_CODE('ctwn'))
  739.     #define kQ3SharedTypeShape                            ((TQ3ObjectType)FOUR_CHAR_CODE('shap'))
  740.  
  741.             
  742.         #define kQ3ShapeTypeGeometry                    ((TQ3ObjectType)FOUR_CHAR_CODE('gmtr'))
  743.             #define kQ3GeometryTypeBox                    ((TQ3ObjectType)FOUR_CHAR_CODE('box '))
  744.             #define kQ3GeometryTypeGeneralPolygon        ((TQ3ObjectType)FOUR_CHAR_CODE('gpgn'))
  745.             #define kQ3GeometryTypeLine                    ((TQ3ObjectType)FOUR_CHAR_CODE('line'))
  746.             #define kQ3GeometryTypeMarker                ((TQ3ObjectType)FOUR_CHAR_CODE('mrkr'))
  747.             #define kQ3GeometryTypePixmapMarker            ((TQ3ObjectType)FOUR_CHAR_CODE('mrkp'))
  748.             #define kQ3GeometryTypeMesh                    ((TQ3ObjectType)FOUR_CHAR_CODE('mesh'))
  749.             #define kQ3GeometryTypeNURBCurve            ((TQ3ObjectType)FOUR_CHAR_CODE('nrbc'))
  750.             #define kQ3GeometryTypeNURBPatch            ((TQ3ObjectType)FOUR_CHAR_CODE('nrbp'))
  751.             #define kQ3GeometryTypePoint                ((TQ3ObjectType)FOUR_CHAR_CODE('pnt '))
  752.             #define kQ3GeometryTypePolygon                ((TQ3ObjectType)FOUR_CHAR_CODE('plyg'))
  753.             #define kQ3GeometryTypePolyLine                ((TQ3ObjectType)FOUR_CHAR_CODE('plyl'))
  754.             #define kQ3GeometryTypeTriangle                ((TQ3ObjectType)FOUR_CHAR_CODE('trng'))
  755.             #define kQ3GeometryTypeTriGrid                ((TQ3ObjectType)FOUR_CHAR_CODE('trig'))
  756.             #define kQ3GeometryTypeCone                    ((TQ3ObjectType)FOUR_CHAR_CODE('cone'))
  757.             #define kQ3GeometryTypeCylinder                ((TQ3ObjectType)FOUR_CHAR_CODE('cyln'))
  758.             #define kQ3GeometryTypeDisk                    ((TQ3ObjectType)FOUR_CHAR_CODE('disk'))
  759.             #define kQ3GeometryTypeEllipse                ((TQ3ObjectType)FOUR_CHAR_CODE('elps'))
  760.             #define kQ3GeometryTypeEllipsoid            ((TQ3ObjectType)FOUR_CHAR_CODE('elpd'))
  761.             #define kQ3GeometryTypePolyhedron            ((TQ3ObjectType)FOUR_CHAR_CODE('plhd'))
  762.             #define kQ3GeometryTypeTorus                ((TQ3ObjectType)FOUR_CHAR_CODE('tors'))
  763.             #define kQ3GeometryTypeTriMesh                ((TQ3ObjectType)FOUR_CHAR_CODE('tmsh'))
  764.  
  765.             
  766.         #define kQ3ShapeTypeShader                        ((TQ3ObjectType)FOUR_CHAR_CODE('shdr'))
  767.             #define kQ3ShaderTypeSurface                ((TQ3ObjectType)FOUR_CHAR_CODE('sush'))
  768.                 #define kQ3SurfaceShaderTypeTexture        ((TQ3ObjectType)FOUR_CHAR_CODE('txsu'))
  769.             #define kQ3ShaderTypeIllumination            ((TQ3ObjectType)FOUR_CHAR_CODE('ilsh'))
  770.                 #define kQ3IlluminationTypePhong        ((TQ3ObjectType)FOUR_CHAR_CODE('phil'))
  771.                 #define kQ3IlluminationTypeLambert        ((TQ3ObjectType)FOUR_CHAR_CODE('lmil'))
  772.                 #define kQ3IlluminationTypeNULL            ((TQ3ObjectType)FOUR_CHAR_CODE('nuil'))
  773.         #define kQ3ShapeTypeStyle                        ((TQ3ObjectType)FOUR_CHAR_CODE('styl'))
  774.             #define kQ3StyleTypeBackfacing                ((TQ3ObjectType)FOUR_CHAR_CODE('bckf'))
  775.             #define kQ3StyleTypeInterpolation            ((TQ3ObjectType)FOUR_CHAR_CODE('intp'))
  776.             #define kQ3StyleTypeFill                    ((TQ3ObjectType)FOUR_CHAR_CODE('fist'))
  777.             #define kQ3StyleTypePickID                    ((TQ3ObjectType)FOUR_CHAR_CODE('pkid'))
  778.             #define kQ3StyleTypeReceiveShadows            ((TQ3ObjectType)FOUR_CHAR_CODE('rcsh'))
  779.             #define kQ3StyleTypeHighlight                ((TQ3ObjectType)FOUR_CHAR_CODE('high'))
  780.             #define kQ3StyleTypeSubdivision                ((TQ3ObjectType)FOUR_CHAR_CODE('sbdv'))
  781.             #define kQ3StyleTypeOrientation                ((TQ3ObjectType)FOUR_CHAR_CODE('ofdr'))
  782.             #define kQ3StyleTypePickParts                ((TQ3ObjectType)FOUR_CHAR_CODE('pkpt'))
  783.             #define kQ3StyleTypeAntiAlias                ((TQ3ObjectType)FOUR_CHAR_CODE('anti'))
  784.  
  785.             
  786.         #define kQ3ShapeTypeTransform                    ((TQ3ObjectType)FOUR_CHAR_CODE('xfrm'))
  787.             #define kQ3TransformTypeMatrix                ((TQ3ObjectType)FOUR_CHAR_CODE('mtrx'))
  788.             #define kQ3TransformTypeScale                ((TQ3ObjectType)FOUR_CHAR_CODE('scal'))
  789.             #define kQ3TransformTypeTranslate            ((TQ3ObjectType)FOUR_CHAR_CODE('trns'))
  790.             #define kQ3TransformTypeRotate                ((TQ3ObjectType)FOUR_CHAR_CODE('rott'))
  791.             #define kQ3TransformTypeRotateAboutPoint     ((TQ3ObjectType)FOUR_CHAR_CODE('rtap'))
  792.             #define kQ3TransformTypeRotateAboutAxis     ((TQ3ObjectType)FOUR_CHAR_CODE('rtaa'))
  793.             #define kQ3TransformTypeQuaternion            ((TQ3ObjectType)FOUR_CHAR_CODE('qtrn'))
  794.             #define kQ3TransformTypeReset                ((TQ3ObjectType)FOUR_CHAR_CODE('rset'))
  795.         #define kQ3ShapeTypeLight                        ((TQ3ObjectType)FOUR_CHAR_CODE('lght'))
  796.             #define kQ3LightTypeAmbient                    ((TQ3ObjectType)FOUR_CHAR_CODE('ambn'))
  797.             #define kQ3LightTypeDirectional                ((TQ3ObjectType)FOUR_CHAR_CODE('drct'))
  798.             #define kQ3LightTypePoint                    ((TQ3ObjectType)FOUR_CHAR_CODE('pntl'))
  799.             #define kQ3LightTypeSpot                    ((TQ3ObjectType)FOUR_CHAR_CODE('spot'))
  800.         #define kQ3ShapeTypeCamera                        ((TQ3ObjectType)FOUR_CHAR_CODE('cmra'))
  801.             #define kQ3CameraTypeOrthographic            ((TQ3ObjectType)FOUR_CHAR_CODE('orth'))
  802.             #define kQ3CameraTypeViewPlane                ((TQ3ObjectType)FOUR_CHAR_CODE('vwpl'))
  803.             #define kQ3CameraTypeViewAngleAspect        ((TQ3ObjectType)FOUR_CHAR_CODE('vana'))
  804.         #define kQ3ShapeTypeGroup                        ((TQ3ObjectType)FOUR_CHAR_CODE('grup'))
  805.             #define kQ3GroupTypeDisplay                    ((TQ3ObjectType)FOUR_CHAR_CODE('dspg'))
  806.                 #define kQ3DisplayGroupTypeOrdered        ((TQ3ObjectType)FOUR_CHAR_CODE('ordg'))
  807.                 #define kQ3DisplayGroupTypeIOProxy        ((TQ3ObjectType)FOUR_CHAR_CODE('iopx'))
  808.             #define kQ3GroupTypeLight                    ((TQ3ObjectType)FOUR_CHAR_CODE('lghg'))
  809.             #define kQ3GroupTypeInfo                    ((TQ3ObjectType)FOUR_CHAR_CODE('info'))
  810.  
  811.             
  812.         #define kQ3ShapeTypeUnknown                        ((TQ3ObjectType)FOUR_CHAR_CODE('unkn'))
  813.             #define kQ3UnknownTypeText                    ((TQ3ObjectType)FOUR_CHAR_CODE('uktx'))
  814.             #define kQ3UnknownTypeBinary                ((TQ3ObjectType)FOUR_CHAR_CODE('ukbn'))
  815.         #define kQ3ShapeTypeReference                    ((TQ3ObjectType)FOUR_CHAR_CODE('rfrn'))
  816.             #define kQ3ReferenceTypeExternal            ((TQ3ObjectType)FOUR_CHAR_CODE('rfex'))
  817.     #define kQ3SharedTypeSet                            ((TQ3ObjectType)FOUR_CHAR_CODE('set '))
  818.         #define kQ3SetTypeAttribute                        ((TQ3ObjectType)FOUR_CHAR_CODE('attr'))
  819.     #define kQ3SharedTypeDrawContext                    ((TQ3ObjectType)FOUR_CHAR_CODE('dctx'))
  820.         #define kQ3DrawContextTypePixmap                ((TQ3ObjectType)FOUR_CHAR_CODE('dpxp'))
  821.         #define kQ3DrawContextTypeMacintosh                ((TQ3ObjectType)FOUR_CHAR_CODE('dmac'))
  822.         #define kQ3DrawContextTypeWin32DC                ((TQ3ObjectType)FOUR_CHAR_CODE('dw32'))
  823.         #define kQ3DrawContextTypeDDSurface                ((TQ3ObjectType)FOUR_CHAR_CODE('ddds'))
  824.         #define kQ3DrawContextTypeX11                    ((TQ3ObjectType)FOUR_CHAR_CODE('dx11'))
  825.     #define kQ3SharedTypeTexture                        ((TQ3ObjectType)FOUR_CHAR_CODE('txtr'))
  826.         #define kQ3TextureTypePixmap                    ((TQ3ObjectType)FOUR_CHAR_CODE('txpm'))    
  827.  
  828.             
  829.     #define kQ3SharedTypeFile                            ((TQ3ObjectType)FOUR_CHAR_CODE('file'))
  830.     #define kQ3SharedTypeStorage                        ((TQ3ObjectType)FOUR_CHAR_CODE('strg'))
  831.         #define kQ3StorageTypeMemory                    ((TQ3ObjectType)FOUR_CHAR_CODE('mems'))
  832.             #define kQ3MemoryStorageTypeHandle            ((TQ3ObjectType)FOUR_CHAR_CODE('hndl'))
  833.         #define kQ3StorageTypeUnix                        ((TQ3ObjectType)FOUR_CHAR_CODE('uxst'))
  834.             #define kQ3UnixStorageTypePath                ((TQ3ObjectType)FOUR_CHAR_CODE('unix'))
  835.         #define kQ3StorageTypeMacintosh                    ((TQ3ObjectType)FOUR_CHAR_CODE('macn'))
  836.             #define kQ3MacintoshStorageTypeFSSpec        ((TQ3ObjectType)FOUR_CHAR_CODE('macp'))                    
  837.         #define kQ3StorageTypeWin32                        ((TQ3ObjectType)FOUR_CHAR_CODE('wist'))
  838.     #define kQ3SharedTypeString                            ((TQ3ObjectType)FOUR_CHAR_CODE('strn'))
  839.         #define kQ3StringTypeCString                    ((TQ3ObjectType)FOUR_CHAR_CODE('strc'))
  840.     #define kQ3SharedTypeShapePart                        ((TQ3ObjectType)FOUR_CHAR_CODE('sprt'))
  841.         #define kQ3ShapePartTypeMeshPart                ((TQ3ObjectType)FOUR_CHAR_CODE('spmh'))
  842.             #define kQ3MeshPartTypeMeshFacePart            ((TQ3ObjectType)FOUR_CHAR_CODE('mfac'))
  843.             #define kQ3MeshPartTypeMeshEdgePart            ((TQ3ObjectType)FOUR_CHAR_CODE('medg'))
  844.             #define kQ3MeshPartTypeMeshVertexPart        ((TQ3ObjectType)FOUR_CHAR_CODE('mvtx'))
  845.     #define kQ3SharedTypeControllerState                ((TQ3ObjectType)FOUR_CHAR_CODE('ctst'))
  846.     #define kQ3SharedTypeTracker                        ((TQ3ObjectType)FOUR_CHAR_CODE('trkr'))
  847.     #define kQ3SharedTypeViewHints                        ((TQ3ObjectType)FOUR_CHAR_CODE('vwhn'))
  848.     #define kQ3SharedTypeEndGroup                        ((TQ3ObjectType)FOUR_CHAR_CODE('endg'))
  849. #define kQ3ObjectTypeEndGroup                            ((TQ3ObjectType)FOUR_CHAR_CODE('endg'))
  850.  
  851. /******************************************************************************
  852.  **                                                                             **
  853.  **                            QuickDraw 3D System Routines                     **
  854.  **                                                                             **
  855.  *****************************************************************************/
  856. EXTERN_API_C( TQ3Status )
  857. Q3Initialize                    (void);
  858.  
  859. EXTERN_API_C( TQ3Status )
  860. Q3Exit                            (void);
  861.  
  862. EXTERN_API_C( TQ3Boolean )
  863. Q3IsInitialized                    (void);
  864.  
  865. EXTERN_API_C( TQ3Status )
  866. Q3GetVersion                    (unsigned long *        majorRevision,
  867.                                  unsigned long *        minorRevision);
  868.  
  869. /*
  870.  *  Q3GetReleaseVersion returns the release version number,
  871.  *  in the format of the first four bytes of a 'vers' resource
  872.  *  (e.g. 0x01518000 ==> 1.5.1 release).
  873.  */
  874. EXTERN_API_C( TQ3Status )
  875. Q3GetReleaseVersion                (unsigned long *        releaseRevision);
  876.  
  877.  
  878. /******************************************************************************
  879.  **                                                                             **
  880.  **                            ObjectClass Routines                             **
  881.  **                                                                             **
  882.  *****************************************************************************/
  883. /*
  884.  *  Q3ObjectClass_Unregister is an obsolete function.  For the new extensions 
  885.  *  model you should now use Q3XObjectHierarchy_UnregisterClass which is 
  886.  *  defined in QD3DExtension.h and takes identical parameters.
  887.  */
  888. EXTERN_API_C( TQ3Status )
  889. Q3ObjectClass_Unregister        (TQ3ObjectClass         objectClass);
  890.  
  891.  
  892. /* 
  893.  *  New object system calls to query the object system.
  894.  *
  895.  *  These comments to move to the stubs file before final release, they 
  896.  *  are here for documentation for developers using early seeds.
  897.  */
  898. /*
  899.  *  Given a class name as a string return the associated class type for the 
  900.  *  class, may return kQ3Failure if the string representing the class is 
  901.  *  invalid.
  902.  */
  903. EXTERN_API_C( TQ3Status )
  904. Q3ObjectHierarchy_GetTypeFromString (TQ3ObjectClassNameString  objectClassString,
  905.                                  TQ3ObjectType *        objectClassType);
  906.  
  907. /*
  908.  *  Given a class type as return the associated string for the class name, 
  909.  *  may return kQ3Failure if the type representing the class is invalid.
  910.  */
  911. EXTERN_API_C( TQ3Status )
  912. Q3ObjectHierarchy_GetStringFromType (TQ3ObjectType         objectClassType,
  913.                                  TQ3ObjectClassNameString  objectClassString);
  914.  
  915. /* 
  916.  *  Return true if the class with this type is registered, false if not 
  917.  */
  918. EXTERN_API_C( TQ3Boolean )
  919. Q3ObjectHierarchy_IsTypeRegistered (TQ3ObjectType         objectClassType);
  920.  
  921. /* 
  922.  *  Return true if the class with this name is registered, false if not 
  923.  */
  924. EXTERN_API_C( TQ3Boolean )
  925. Q3ObjectHierarchy_IsNameRegistered (const char *        objectClassName);
  926.  
  927. /*
  928.  * TQ3SubClassData is used when querying the object system for
  929.  * the subclasses of a particular parent type:
  930.  */
  931.  
  932. struct TQ3SubClassData {
  933.     unsigned long                     numClasses;                    /* the # of subclass types found for a parent class */
  934.     TQ3ObjectType *                    classTypes;                    /* an array containing the class types */
  935. };
  936. typedef struct TQ3SubClassData            TQ3SubClassData;
  937. /*
  938.  *  Given a parent type and an instance of the TQ3SubClassData struct fill
  939.  *  it in with the number and class types of all of the subclasses immediately
  940.  *  below the parent in the class hierarchy.  Return kQ3Success to indicate no
  941.  *  errors occurred, else kQ3Failure.
  942.  *
  943.  *  NOTE:  This function will allocate memory for the classTypes array.  Be 
  944.  *    sure to call Q3ObjectClass_EmptySubClassData to free this memory up.
  945.  */
  946. EXTERN_API_C( TQ3Status )
  947. Q3ObjectHierarchy_GetSubClassData (TQ3ObjectType         objectClassType,
  948.                                  TQ3SubClassData *        subClassData);
  949.  
  950. /*
  951.  *  Given an instance of the TQ3SubClassData struct free all memory allocated 
  952.  *    by the Q3ObjectClass_GetSubClassData call.
  953.  *
  954.  *  NOTE: This call MUST be made after a call to Q3ObjectClass_GetSubClassData
  955.  *  to avoid memory leaks.
  956.  */
  957. EXTERN_API_C( TQ3Status )
  958. Q3ObjectHierarchy_EmptySubClassData (TQ3SubClassData *    subClassData);
  959.  
  960.  
  961. /******************************************************************************
  962.  **                                                                             **
  963.  **                                Object Routines                                 **
  964.  **                                                                             **
  965.  *****************************************************************************/
  966. EXTERN_API_C( TQ3Status )
  967. Q3Object_Dispose                (TQ3Object                 object);
  968.  
  969. EXTERN_API_C( TQ3Object )
  970. Q3Object_Duplicate                (TQ3Object                 object);
  971.  
  972. EXTERN_API_C( TQ3Status )
  973. Q3Object_Submit                    (TQ3Object                 object,
  974.                                  TQ3ViewObject             view);
  975.  
  976. EXTERN_API_C( TQ3Boolean )
  977. Q3Object_IsDrawable                (TQ3Object                 object);
  978.  
  979. EXTERN_API_C( TQ3Boolean )
  980. Q3Object_IsWritable                (TQ3Object                 object,
  981.                                  TQ3FileObject             theFile);
  982.  
  983.  
  984. /******************************************************************************
  985.  **                                                                             **
  986.  **                            Object Type Routines                             **
  987.  **                                                                             **
  988.  *****************************************************************************/
  989. EXTERN_API_C( TQ3ObjectType )
  990. Q3Object_GetType                (TQ3Object                 object);
  991.  
  992. EXTERN_API_C( TQ3ObjectType )
  993. Q3Object_GetLeafType            (TQ3Object                 object);
  994.  
  995. EXTERN_API_C( TQ3Boolean )
  996. Q3Object_IsType                    (TQ3Object                 object,
  997.                                  TQ3ObjectType             theType);
  998.  
  999.  
  1000. /******************************************************************************
  1001.  **                                                                             **
  1002.  **                            Shared Object Routines                             **
  1003.  **                                                                             **
  1004.  *****************************************************************************/
  1005. EXTERN_API_C( TQ3ObjectType )
  1006. Q3Shared_GetType                (TQ3SharedObject         sharedObject);
  1007.  
  1008. EXTERN_API_C( TQ3SharedObject )
  1009. Q3Shared_GetReference            (TQ3SharedObject         sharedObject);
  1010.  
  1011. /* 
  1012.  *    Q3Shared_IsReferenced
  1013.  *        Returns kQ3True if there is more than one reference to sharedObject.
  1014.  *        Returns kQ3False if there is ONE reference to sharedObject.
  1015.  *    
  1016.  *    This call is intended to allow applications and plug-in objects to delete
  1017.  *    objects of which they hold THE ONLY REFERENCE. This is useful when
  1018.  *    caching objects, etc.
  1019.  *    
  1020.  *    Although many may be tempted, DO NOT DO THIS:
  1021.  *        while (Q3Shared_IsReferenced(foo)) { Q3Object_Dispose(foo); }
  1022.  *    
  1023.  *    Your application will crash and no one will buy it. Chapter 11 is 
  1024.  *    never fun (unless you short the stock). Thanks.
  1025.  */
  1026. EXTERN_API_C( TQ3Boolean )
  1027. Q3Shared_IsReferenced            (TQ3SharedObject         sharedObject);
  1028.  
  1029. /*
  1030.  *    Q3Shared_GetEditIndex
  1031.  *        Returns the "serial number" of sharedObject. Usefuly for caching 
  1032.  *        object information. Returns 0 on error.
  1033.  *        
  1034.  *        Hold onto this number to determine if an object has changed since you
  1035.  *        last built your caches... To validate, do:
  1036.  *        
  1037.  *        if (Q3Shared_GetEditIndex(foo) == oldFooEditIndex) {
  1038.  *            // Cache is valid
  1039.  *        } else {
  1040.  *            // Cache is invalid
  1041.  *            RebuildSomeSortOfCache(foo);
  1042.  *            oldFooEditIndex = Q3Shared_GetEditIndex(foo);
  1043.  *        }
  1044.  */
  1045. EXTERN_API_C( unsigned long )
  1046. Q3Shared_GetEditIndex            (TQ3SharedObject         sharedObject);
  1047.  
  1048. /*
  1049.  *    Q3Shared_Edited
  1050.  *        Bumps the "serial number" of sharedObject to a different value. This
  1051.  *        call is intended to be used solely from a plug-in object which is 
  1052.  *        shared. Call this whenever your private instance data changes.
  1053.  *        
  1054.  *        Returns kQ3Failure iff sharedObject is not a shared object, OR
  1055.  *            QuickDraw 3D isn't initialized.
  1056.  */
  1057. EXTERN_API_C( TQ3Status )
  1058. Q3Shared_Edited                    (TQ3SharedObject         sharedObject);
  1059.  
  1060.  
  1061. /******************************************************************************
  1062.  **                                                                             **
  1063.  **                                Shape Routines                                 **
  1064.  **                                                                             **
  1065.  *****************************************************************************/
  1066. /*
  1067.  *    QuickDraw 3D 1.1 Note:
  1068.  *
  1069.  *    Shapes and Sets are now (sort of) polymorphic.
  1070.  *
  1071.  *        You may call Q3Shape_Foo or Q3Set_Foo on a shape or a set.
  1072.  *        The following calls are identical, in implementation:
  1073.  *
  1074.  *            Q3Shape_GetElement            =    Q3Set_Get
  1075.  *            Q3Shape_AddElement            =    Q3Set_Add
  1076.  *            Q3Shape_ContainsElement        =    Q3Set_Contains
  1077.  *            Q3Shape_GetNextElementType    =    Q3Set_GetNextElementType
  1078.  *            Q3Shape_EmptyElements        =    Q3Set_Empty
  1079.  *            Q3Shape_ClearElement        =    Q3Set_Clear
  1080.  *
  1081.  *    All of these calls accept a shape or a set as their first parameter.
  1082.  *
  1083.  *    The Q3Shape_GetSet and Q3ShapeSetSet calls are implemented via a new
  1084.  *    element type kQ3ElementTypeSet. See the note above about 
  1085.  *    kQ3ElementTypeSet;
  1086.  *
  1087.  *    It is important to note that the new Q3Shape_...Element... calls do not
  1088.  *    create a set on a shape and then add the element to it. This data is
  1089.  *    attached directly to the shape. Therefore, it is possible for an element
  1090.  *    to exist on a shape without a set existing on it as well. 
  1091.  *
  1092.  *    In your application, if you attach an element to a shape like this:
  1093.  *        (this isn't checking for errors for simplicity)
  1094.  *
  1095.  *        set = Q3Set_New();
  1096.  *        Q3Set_AddElement(set, kMyElemType, &data);
  1097.  *        Q3Shape_SetSet(shape, set);
  1098.  *
  1099.  *    You should retrieve it in the same manner:
  1100.  *
  1101.  *        Q3Shape_GetSet(shape, &set);
  1102.  *        if (Q3Set_Contains(set, kMyElemType) == kTrue) {
  1103.  *            Q3Set_Get(set, kMyElemType, &data);
  1104.  *        }
  1105.  *
  1106.  *    Similarly, if you attach data to a shape with the new calls:
  1107.  *
  1108.  *        Q3Shape_AddElement(shape, kMyElemType, &data);
  1109.  *
  1110.  *    You should retrieve it in the same manner:
  1111.  *
  1112.  *        if (Q3Shape_ContainsElement(set, kMyElemType) == kTrue) {
  1113.  *            Q3Shape_GetElement(set, kMyElemType, &data);
  1114.  *        }
  1115.  *
  1116.  *    This really becomes an issue when dealing with version 1.0 and version 1.1 
  1117.  *    metafiles.
  1118.  *
  1119.  *    When attempting to find a particular element on a shape, you should
  1120.  *    first check with Q3Shape_GetNextElementType or Q3Shape_GetElement, then,
  1121.  *    Q3Shape_GetSet(s, &set) (or Q3Shape_GetElement(s, kQ3ElementTypeSet, &set))
  1122.  *    and then Q3Shape_GetElement(set, ...).
  1123.  *
  1124.  *    In terms of implementation, Q3Shape_SetSet and Q3Shape_GetSet should only be
  1125.  *    used for sets of information that are shared among multiple shapes.
  1126.  *    
  1127.  *    Q3Shape_AddElement, Q3Shape_GetElement, etc. calls should only be used
  1128.  *    for elements that are unique for a particular shape.
  1129.  *    
  1130.  */
  1131. EXTERN_API_C( TQ3ObjectType )
  1132. Q3Shape_GetType                    (TQ3ShapeObject         shape);
  1133.  
  1134. EXTERN_API_C( TQ3Status )
  1135. Q3Shape_GetSet                    (TQ3ShapeObject         shape,
  1136.                                  TQ3SetObject *            theSet);
  1137.  
  1138. EXTERN_API_C( TQ3Status )
  1139. Q3Shape_SetSet                    (TQ3ShapeObject         shape,
  1140.                                  TQ3SetObject             theSet);
  1141.  
  1142. EXTERN_API_C( TQ3Status )
  1143. Q3Shape_AddElement                (TQ3ShapeObject         shape,
  1144.                                  TQ3ElementType         theType,
  1145.                                  const void *            data);
  1146.  
  1147. EXTERN_API_C( TQ3Status )
  1148. Q3Shape_GetElement                (TQ3ShapeObject         shape,
  1149.                                  TQ3ElementType         theType,
  1150.                                  void *                    data);
  1151.  
  1152. EXTERN_API_C( TQ3Boolean )
  1153. Q3Shape_ContainsElement            (TQ3ShapeObject         shape,
  1154.                                  TQ3ElementType         theType);
  1155.  
  1156. EXTERN_API_C( TQ3Status )
  1157. Q3Shape_GetNextElementType        (TQ3ShapeObject         shape,
  1158.                                  TQ3ElementType *        theType);
  1159.  
  1160. EXTERN_API_C( TQ3Status )
  1161. Q3Shape_EmptyElements            (TQ3ShapeObject         shape);
  1162.  
  1163. EXTERN_API_C( TQ3Status )
  1164. Q3Shape_ClearElement            (TQ3ShapeObject         shape,
  1165.                                  TQ3ElementType         theType);
  1166.  
  1167.  
  1168.  
  1169. #if PRAGMA_ENUM_ALWAYSINT
  1170.     #pragma enumsalwaysint reset
  1171. #elif PRAGMA_ENUM_OPTIONS
  1172.     #pragma option enum=reset
  1173. #elif defined(PRAGMA_ENUM_PACK__QD3D__)
  1174.     #pragma options(pack_enums)
  1175. #endif
  1176.  
  1177. #if PRAGMA_STRUCT_ALIGN
  1178.     #pragma options align=reset
  1179. #elif PRAGMA_STRUCT_PACKPUSH
  1180.     #pragma pack(pop)
  1181. #elif PRAGMA_STRUCT_PACK
  1182.     #pragma pack()
  1183. #endif
  1184.  
  1185. #ifdef PRAGMA_IMPORT_OFF
  1186. #pragma import off
  1187. #elif PRAGMA_IMPORT
  1188. #pragma import reset
  1189. #endif
  1190.  
  1191. #ifdef __cplusplus
  1192. }
  1193. #endif
  1194.  
  1195. #endif /* __QD3D__ */
  1196.  
  1197.